﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LEET.CommonInterfaces.Automation;

namespace LEET.LEETCommon.AutomationAbstractions
{
    class UIPathTail : IUIPath
    {
        private int start;
        private UIPath original;
        public UIPathTail(int start, UIPath original)
        {
            this.start = start;
            this.original = original;
        }

        public IUIPathElement head
        {
            get
            {
                if (original.Count() > start)
                    return original.ElementAt(start);
                else
                    return null;
            }
        }

        public IUIPath tail
        {
            get
            {
                if (original.Count() > start)
                    return new UIPathTail(start + 1, original);
                else
                    return new UIPath();
            }
        }

        public override string ToString()
        {
            return head + ", " + tail.ToString();
        }


        public void Add(IUIPathElement elem)
        {
            original.Add(elem);
        }
    }
}
